package com.wzh.service;

import com.wzh.dao.UserDao;
import com.wzh.pojo.Po.Notes;
import com.wzh.pojo.Po.UserZp;
import com.wzh.pojo.Po.Users;
import com.wzh.pojo.Req.DataReq;
import com.wzh.pojo.Resp.DataResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserService {
	@Autowired
	private UserDao userDao;
	public DataResp<Object> show(DataReq req) {
		DataResp<Object> resp=new DataResp<>();
		List<UserZp> list= userDao.find(req);
		if (list.size()!=0){
			resp.setData(list);
			resp.setMes("查询成功！");
		}else{
			resp.setMes("查询失败！");
		}
		return  resp;
	}

	public DataResp<Object> addusers(Users users) {

		DataResp<Object> resp=new DataResp<>();
		Integer code =userDao.addusers(users.getUsers());

		if (code>0){
			resp.setMes("操作成功！");
		}else {
			resp.setMes("操作失败！");
		}
		return  resp;
	}
}
